var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var EventManager = require("AA_EventManager");
var ResKeeper = require("AA_ResKeeper");
var EvenType = require("AA_EvenType");
var PlayerDataManager = require("AA_PlayerDataManager");
var Excel = require("AA_Excel");
var GameDataManager = require("AA_GameDataManager");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_Module_Fighting_RedPoint = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.huangdong = null;
    t.type = 1;
    t.huangtw = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onEnable = function () {
    switch (this.type) {
      case 1:
        EventManager.EventMgr.addEventListener(EvenType.EVENT_TYPE.Game_Update_Level_Award, this.onUpdatUi, this);
        this.onUpdatUi();
        break;
      case 2:
        EventManager.EventMgr.addEventListener(EvenType.EVENT_TYPE.HOME_QIANDAO_UPDATE, this.onQianDao, this);
        this.onQianDao();
    }
  };
  _creator.prototype.onQianDao = function () {
    PlayerDataManager.PlayerDataMgr.resetQianDaoCount();
    if (1 == PlayerDataManager.PlayerDataMgr.globalData.isqiandaocode && PlayerDataManager.PlayerDataMgr.globalData.qiandaocount < 9) {
      this.node.children[0].active = true;
      this.startHuang();
    } else {
      if (this.huangtw) {
        this.huangtw.stop();
        this.huangdong && (this.huangdong.angle = 0);
      }
      this.huangdong && this.huangdong.stopAllActions();
      this.node.children[0].active = false;
    }
  };
  _creator.prototype.startHuang = function () {
    if (this.huangdong) {
      var e = cc.tween(this.huangdong).to(.1, {
        angle: -10
      }).to(.1, {
        angle: 10
      }).to(.1, {
        angle: -5
      }).to(.1, {
        angle: 5
      }).to(.1, {
        angle: 0
      }).delay(.2);
      this.huangtw = cc.tween(this.huangdong).repeatForever(e).start();
    }
  };
  _creator.prototype.onUpdatUi = function () {
    var e = Excel.Excel.shuiguolevel_all.size;
    var t = false;
    for (var o = 0; o < e; o++) {
      if (GameDataManager.GameDataMgr.getLevelAwardHave(o + 1)) {
        t = true;
        break;
      }
    }
    this.node.children[0].active = t;
  };
  _creator.prototype.onDisable = function () {
    EventManager.EventMgr.rmEventListener(EvenType.EVENT_TYPE.Game_Update_Level_Award, this.onUpdatUi, this);
    EventManager.EventMgr.rmEventListener(EvenType.EVENT_TYPE.HOME_QIANDAO_UPDATE, this.onQianDao, this);
  };
  __decorate([_property(cc.Node)], _creator.prototype, "huangdong", undefined);
  __decorate([_property()], _creator.prototype, "type", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_Module_Fighting_RedPoint;